<template>
    <div>
        <div class="title">
            <h2>限时折扣课程
                <a href="#" class="chose-more">
                    更多
                    <img src="../../../assets/right.png" alt="">
                </a></h2>
        </div>
        <ul class="discountList">
            <li v-for="(item) in discountData" :key="item.courseId">
                <router-link :to="{path:'/course',query:{id:item.courseId}}" >
                <div><a href="#"><img :src="item.bannerFileUrl" alt=""></a></div>
                <p>{{item.courseTitle}}</p>
                <p>共{{item.courseId}}节课 | {{item.participationsCount}}人报名</p>
                <span>&yen;&nbsp;{{item.coursePrice}} <s>￥{{item.discountPrice}}</s></span>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
    import {getCourse} from "../../../api";

    export default {
        name: "discountCourse",
    data() {
        return{
            discountData: [],//折扣课程数据列表
        }
    },
    methods:{

    },
    created() {
        getCourse("discount","1",5).then(res=>{
            this.discountData = res.rows;
        }).catch(err=>{
            console.log(err)
        })
    },
    }
</script>

<style scoped lang="less">
    * {
        margin: 0;
        padding: 0;
    }

    ul li {
        list-style: none;
    }

    .freeList,
    .discountList,
    .boutiqueList {
        width: 1200px;
        margin: auto;
        s {
            color: #999;
            /*text-decoration: line-through;*/
            font-size: 12px;
        }
    }

    h2 {
        text-align: center;
        margin-top: 50px;
        a {
            float: right;
            color: #999!important;
            font-size: 16px;
            line-height: 40px;
            font-weight: 400;
        }
    }

    .title {
        margin: auto;
        width: 1200px;
        padding: 0 12px 10px 62px;
        border-bottom: 2px solid #e8e8e8;
    }

    .discountList {
        overflow: hidden;
    }

    .discountList>li {
        float: left;
        padding: 8px;
        overflow: hidden;

    }

    .discountList>li div {
        overflow: hidden;
        width: 224px;
        height: 135px;
    }

    .discountList>li div>a>img {
        position: relative;
        width: 100%;
        height: 100%;
        transition: 1s;
    }

    .discountList>li div>a>img:hover {
        transform: scale(1.2, 1.2);
    }

    .discountList>li p:nth-of-type(1) {
        width: 200px;
        padding-top: 10px;
        font-weight: 500;
        color: #000;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .discountList>li p:nth-of-type(2) {
        color: #888;
        font-weight: 500;
    }

    .discountList>li span {
        color: #ff4500;
        font-size: 16px;
    }

    .discountList>li span:nth-of-type(2) {
        color: #999;
        text-decoration: line-through;
        font-size: 12px;
    }

    .discountList>li:hover {
        cursor: pointer;
    }

    .discountList>li:hover p:nth-of-type(1) {
        color: #00cf8c;

    }

    .discountList>li>p:nth-of-type(3) {
        float: right;
        color: #fa8c16;
        background: #fff7e6;
        border-color: #ffd591;
        height: 22px;
        margin-right: 8px;
        padding: 0 7px;
        font-size: 12px;
        line-height: 20px;
        white-space: nowrap;
    }
</style>